{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "import torch.nn as nn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "class VGG(nn.Module):\n",
    "    def __init__(self, num_classes=1000):\n",
    "        super(VGG, self).__init__()\n",
    "        self.cfg = [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 'M']\n",
    "        self.features = self.make_layers(self.cfg)\n",
    "        self.classifier = nn.Sequential(\n",
    "            nn.Linear(512 * 7 * 7, 4096),\n",
    "            nn.ReLU(True),\n",
    "            nn.Dropout(),\n",
    "            nn.Linear(4096, 4096),\n",
    "            nn.ReLU(True),\n",
    "            nn.Dropout(),\n",
    "            nn.Linear(4096, num_classes),\n",
    "\n",
    "        )\n",
    "        \"\"\"\n",
    "        input: 224x224x3\n",
    "        \"\"\"\n",
    "\n",
    "    def make_layers(self, cfg):\n",
    "        layers = []\n",
    "        in_channels = 3\n",
    "        for v in cfg:\n",
    "            if v == 'M':\n",
    "                layers += [nn.MaxPool2d(kernel_size=2, stride=2)]\n",
    "            else:\n",
    "                conv2d = nn.Conv2d(in_channels, v, kernel_size=3, padding=1) # same padding kernel_size=3 padding=1  (input_size - kernel_size + 2*padding)/stride + 1 保证Feature Map大小不变 \n",
    "                layers += [conv2d, nn.ReLU(inplace=True)]\n",
    "                in_channels = v\n",
    "        return nn.Sequential(*layers)\n",
    "    \n",
    "    def forward(self, x):\n",
    "        x = self.features(x)\n",
    "        x = torch.flatten(x, 1)\n",
    "        x = self.classifier(x)\n",
    "        return x\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = VGG(num_classes=1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torch.Size([1, 1000])\n",
      "tensor([[-2.1571e-04, -3.0892e-03,  7.7751e-03, -1.6647e-02, -2.0438e-03,\n",
      "         -1.7370e-02, -5.7834e-03, -1.1191e-02,  4.6317e-03,  5.9579e-03,\n",
      "         -2.4615e-03, -5.3479e-03, -1.0261e-03,  4.7944e-03,  8.1189e-03,\n",
      "         -1.1301e-02,  1.3611e-03, -2.8664e-03, -9.7073e-03, -1.6588e-02,\n",
      "          7.5476e-03, -9.9461e-04, -1.6546e-02, -4.7057e-03, -1.3840e-02,\n",
      "          3.3188e-03, -2.3176e-03, -1.6532e-03,  6.8109e-03,  1.4377e-03,\n",
      "          1.0687e-03, -3.3004e-03, -8.4660e-03,  6.0408e-03, -7.6093e-03,\n",
      "          9.4761e-03,  9.1283e-03, -1.6989e-02,  1.3674e-02, -5.6101e-04,\n",
      "          1.3572e-02, -1.2688e-02, -1.3248e-02, -8.7240e-03, -8.4467e-03,\n",
      "          1.5345e-02,  2.1698e-03,  4.9421e-05, -1.4741e-02, -7.6398e-03,\n",
      "         -2.5418e-03,  8.4016e-03,  2.1831e-03,  2.7249e-03,  9.9045e-04,\n",
      "         -8.7492e-03,  2.3355e-02,  1.7625e-02,  8.3611e-04, -1.8907e-02,\n",
      "          8.2583e-03, -2.0440e-02, -8.3696e-03,  1.8975e-02, -7.7359e-03,\n",
      "          1.5401e-02, -7.5732e-03,  5.5118e-03,  2.1315e-02, -2.4272e-02,\n",
      "         -5.5045e-03, -1.7973e-02,  4.4195e-03, -4.1758e-03, -5.7959e-03,\n",
      "          3.7895e-03, -1.8316e-03, -8.8499e-03,  5.2066e-03, -6.9317e-03,\n",
      "          8.9826e-03,  8.7304e-03, -3.6811e-03,  1.5630e-02, -6.0961e-03,\n",
      "          7.1701e-03,  3.0307e-03,  1.5532e-02, -5.9875e-03,  5.1059e-05,\n",
      "         -1.1505e-03, -1.0475e-02, -7.4251e-03, -2.0937e-02, -4.4901e-03,\n",
      "          1.4780e-02,  8.3960e-03,  6.6769e-03, -1.3378e-03, -8.0566e-03,\n",
      "         -1.8784e-04,  2.0614e-02,  1.5368e-02, -8.0304e-03, -1.1326e-02,\n",
      "         -9.2845e-03,  5.1749e-03,  7.7025e-03, -1.4421e-02, -2.1497e-03,\n",
      "         -8.2944e-03, -1.3685e-02, -1.4305e-02,  1.5948e-03,  7.2496e-03,\n",
      "         -1.2449e-03, -1.3184e-02,  2.7482e-03,  1.0129e-02,  1.0834e-02,\n",
      "         -7.9575e-03,  9.2485e-03, -1.3565e-02,  1.8156e-02, -3.4423e-03,\n",
      "         -7.4606e-04, -7.0536e-03, -1.7332e-02, -6.3554e-03, -1.7088e-04,\n",
      "         -1.9900e-02,  1.0271e-02, -3.3476e-03, -7.7509e-03,  7.4205e-03,\n",
      "          2.5508e-03,  1.2525e-02,  1.2868e-03,  7.2737e-03,  3.0871e-03,\n",
      "          1.0957e-02,  6.6030e-03, -1.2496e-03, -1.3350e-02,  8.8093e-03,\n",
      "          9.5066e-03,  1.1399e-02,  1.5630e-02,  7.5979e-03, -1.5734e-02,\n",
      "         -4.5802e-03,  3.7843e-03, -5.6833e-04,  1.2554e-02,  5.9002e-03,\n",
      "          6.9951e-03,  1.3572e-02,  2.3801e-04,  9.3283e-03,  1.2207e-02,\n",
      "         -6.4602e-03,  3.8695e-03,  7.9453e-03,  7.7660e-03,  1.6847e-02,\n",
      "          9.0148e-03,  1.2931e-03,  1.1149e-02, -3.8381e-03, -7.2204e-03,\n",
      "          1.2960e-02,  7.0337e-03,  2.1025e-02, -3.5356e-03,  8.6600e-03,\n",
      "          5.1019e-03,  1.8106e-02, -9.5404e-03, -1.7233e-02, -2.1476e-03,\n",
      "          3.0799e-03,  8.4454e-03, -1.1585e-02, -1.3327e-02,  1.6708e-02,\n",
      "          5.3523e-04,  1.2303e-02,  6.0406e-03, -5.2023e-03, -3.2848e-03,\n",
      "         -1.5321e-02,  1.7208e-05, -9.7147e-03,  1.2084e-02,  5.4658e-04,\n",
      "         -4.2002e-03, -3.6937e-04,  1.1888e-02, -2.0278e-02, -1.3010e-02,\n",
      "         -1.9597e-02,  1.5362e-02, -9.0587e-03, -6.4584e-03,  9.1793e-04,\n",
      "          1.9730e-03,  1.1772e-02,  1.3073e-03,  1.5311e-03, -8.1473e-03,\n",
      "         -7.7196e-03,  1.4084e-02, -8.8369e-04,  5.9856e-04, -6.7627e-03,\n",
      "          4.9867e-03, -8.1639e-03, -5.2316e-03,  1.6905e-02, -1.0667e-02,\n",
      "         -6.4777e-03, -1.8867e-03,  2.2742e-03,  3.6518e-03,  1.0555e-02,\n",
      "          2.7307e-03,  1.0366e-02,  7.8327e-03,  5.4738e-03, -1.1388e-02,\n",
      "          1.5037e-04,  1.5403e-02,  4.3338e-03, -2.7063e-03, -2.7400e-03,\n",
      "         -1.2439e-02,  1.2723e-03, -3.2373e-03, -3.4593e-03,  2.0130e-04,\n",
      "         -3.9216e-03,  1.3821e-02, -9.2149e-03,  1.5628e-02, -4.3876e-03,\n",
      "          6.3966e-04,  9.5965e-04, -8.2382e-03,  6.8734e-04,  4.8106e-03,\n",
      "          5.8217e-03,  1.0023e-02,  1.1312e-03,  2.2076e-03, -5.6951e-03,\n",
      "          5.6481e-03, -1.1835e-02, -1.3546e-02, -5.0251e-03, -6.3788e-03,\n",
      "         -6.4504e-03,  1.0384e-02,  1.0013e-02,  1.8761e-04,  4.3836e-03,\n",
      "         -1.6845e-02,  6.6326e-03, -1.7794e-02,  1.6356e-03, -6.5686e-03,\n",
      "         -9.2296e-04,  1.2174e-02,  2.8546e-03, -3.5857e-03,  1.5669e-02,\n",
      "         -7.1655e-03,  2.3993e-04, -3.1527e-03, -1.0985e-02, -7.4165e-03,\n",
      "         -2.0384e-03,  1.2890e-02,  9.7463e-03,  1.5082e-02, -7.6129e-03,\n",
      "          1.9400e-03,  5.4012e-03,  1.0985e-02,  1.0423e-02, -7.4907e-03,\n",
      "         -1.3000e-02,  2.6453e-03, -1.5197e-02, -9.8520e-03,  9.8619e-03,\n",
      "          4.1788e-03, -5.7241e-03,  8.4949e-03, -2.1299e-02,  1.0497e-03,\n",
      "          1.9864e-03, -7.3209e-03,  1.2468e-02, -1.1857e-02,  1.9408e-02,\n",
      "          1.5948e-02,  7.1813e-03,  1.9551e-02,  1.9404e-02,  1.8062e-02,\n",
      "          1.5076e-03, -2.0301e-03, -1.0014e-02, -6.0542e-03, -3.9555e-03,\n",
      "         -8.4054e-05, -2.6272e-03, -1.3943e-02, -1.4181e-02, -3.7120e-03,\n",
      "          1.1627e-02,  1.6452e-02, -1.5943e-03, -2.7535e-03, -1.5249e-02,\n",
      "          2.1927e-03,  1.5170e-02,  3.4372e-03,  1.2354e-02,  1.3561e-02,\n",
      "          1.2238e-02, -1.1470e-02,  2.7544e-04, -5.0365e-03, -1.0971e-03,\n",
      "          4.5195e-03, -3.4988e-03, -6.0770e-03,  1.7759e-02, -6.0325e-05,\n",
      "          1.2845e-02, -3.7977e-03,  8.8595e-03, -1.6390e-02,  5.1069e-03,\n",
      "          1.2732e-02, -7.1051e-03,  7.3827e-03, -1.6997e-02, -9.0159e-03,\n",
      "         -1.4204e-02, -1.5712e-02, -9.6688e-04, -9.6030e-03, -1.9607e-03,\n",
      "         -5.0214e-03, -5.5980e-03,  2.0794e-02, -1.1799e-02, -5.9944e-03,\n",
      "         -4.1142e-03, -6.1034e-03,  1.5259e-03, -1.3167e-02, -1.8154e-02,\n",
      "          2.2744e-03,  8.7955e-03, -1.0481e-02, -1.1006e-02, -7.0452e-04,\n",
      "          1.3009e-02, -1.4311e-02, -5.5685e-03,  5.7771e-03,  1.3966e-02,\n",
      "          2.3610e-03, -1.5313e-02,  1.5947e-02,  3.6756e-03,  5.4455e-03,\n",
      "          5.3829e-03, -2.8506e-03, -1.3645e-02,  3.4898e-03,  1.4085e-02,\n",
      "          6.0739e-03,  3.5687e-03, -9.1782e-03, -2.7474e-03,  6.4271e-03,\n",
      "          1.0954e-02,  1.0085e-02, -9.7061e-03, -4.3018e-03,  3.7476e-03,\n",
      "         -5.3190e-04,  1.4739e-03, -5.8388e-04,  3.1557e-04,  2.5341e-03,\n",
      "          1.0215e-02,  1.7734e-03, -1.8924e-03,  1.1524e-02,  6.2238e-03,\n",
      "         -1.3269e-02,  2.3782e-02, -1.2591e-02,  2.6587e-03, -2.4636e-03,\n",
      "         -1.9695e-03,  5.4628e-03,  2.8806e-03, -1.1007e-02,  1.7799e-03,\n",
      "          1.3307e-03,  1.7613e-03, -2.9895e-03, -9.7643e-04, -1.6912e-02,\n",
      "         -2.1313e-02,  9.5175e-03, -4.9104e-03,  7.3308e-03,  1.2907e-02,\n",
      "         -1.0605e-02, -8.9986e-03,  2.1100e-02,  1.5574e-02,  1.6342e-02,\n",
      "         -9.7844e-03,  7.0722e-03, -1.0286e-02, -1.2993e-02, -1.7544e-02,\n",
      "         -1.4209e-02, -1.9554e-02, -1.1734e-02,  1.5455e-02,  9.7439e-04,\n",
      "         -1.1851e-02, -1.1824e-02, -5.6614e-03, -2.1995e-02,  1.2703e-02,\n",
      "          2.9744e-03, -1.0108e-02,  1.3343e-02, -1.3771e-03,  2.5210e-03,\n",
      "         -4.0742e-03, -1.3086e-02, -1.6723e-03,  2.1767e-02,  1.4774e-02,\n",
      "          1.9723e-02,  9.8957e-03,  6.2661e-04,  4.3022e-03,  1.8208e-04,\n",
      "         -1.1770e-02,  6.7511e-03, -5.8308e-03,  7.2227e-03,  1.8546e-02,\n",
      "          4.6447e-03,  4.0694e-03, -7.8108e-03,  3.7048e-03,  3.9365e-03,\n",
      "         -1.2845e-03,  2.1671e-03, -1.1050e-02, -1.3335e-02, -1.4861e-02,\n",
      "          1.1543e-02,  6.7200e-03,  1.5646e-02,  2.7634e-03,  7.3940e-03,\n",
      "          2.1561e-02, -1.1449e-02,  1.7762e-03,  1.2645e-02, -9.6399e-03,\n",
      "          1.5146e-02, -7.9591e-03, -8.1156e-03, -1.7990e-03, -1.4299e-02,\n",
      "         -1.3793e-02,  7.2980e-03, -1.1493e-02,  5.3031e-04, -1.6933e-02,\n",
      "         -1.5943e-03,  3.8759e-03,  1.7689e-02, -1.7725e-03,  1.6974e-02,\n",
      "         -8.8949e-03, -3.0711e-03, -1.7265e-02,  5.6379e-03, -5.1321e-04,\n",
      "         -6.1783e-03, -1.6339e-04, -1.2680e-02, -7.7804e-03,  3.0548e-03,\n",
      "         -7.3898e-03, -1.7791e-02,  6.9915e-03,  6.2644e-03,  1.6675e-02,\n",
      "         -1.3438e-02,  1.9421e-03, -4.2273e-03,  8.6062e-03,  1.5314e-02,\n",
      "          3.4094e-03,  1.6942e-02,  3.2545e-03, -2.6832e-02, -3.4241e-03,\n",
      "         -1.0190e-02, -6.4851e-03, -5.4965e-03,  1.3255e-03, -3.6657e-03,\n",
      "          2.0686e-02, -1.9354e-02, -1.4999e-02,  1.5560e-02, -1.3237e-02,\n",
      "         -3.2538e-03, -1.6438e-02, -7.6505e-03, -1.3200e-02, -8.7822e-03,\n",
      "          1.2497e-02,  2.1867e-02, -9.5411e-03, -5.5401e-05, -3.8741e-03,\n",
      "          1.5767e-02,  1.2985e-02, -5.9457e-03, -5.8993e-03, -1.4483e-03,\n",
      "          7.4218e-03,  1.0854e-02,  1.0366e-02,  1.2422e-02, -3.6033e-03,\n",
      "         -8.5859e-03, -1.0615e-02,  7.8287e-04,  1.2457e-02,  3.7100e-03,\n",
      "         -6.1557e-04,  2.4212e-04, -3.3588e-03,  9.4494e-03, -5.2697e-03,\n",
      "          9.9305e-04,  1.2228e-02,  1.1170e-02, -6.5386e-03,  1.2846e-02,\n",
      "          3.2800e-03,  1.4226e-02,  9.9742e-03,  8.3632e-03,  6.5157e-03,\n",
      "         -1.8036e-02, -6.5434e-03, -8.2455e-03, -1.1413e-02, -4.7303e-03,\n",
      "          6.9745e-03,  6.6344e-04,  1.0396e-02,  7.6491e-03, -3.8004e-03,\n",
      "         -2.1303e-02,  1.3721e-02,  2.3914e-03,  2.1753e-04,  8.6055e-03,\n",
      "          1.5647e-04, -5.8451e-03, -1.1315e-02,  8.8727e-03, -2.8685e-03,\n",
      "          7.0960e-03, -5.0206e-03, -6.5229e-03, -1.9878e-03,  8.8567e-03,\n",
      "         -5.0403e-03, -1.5567e-02, -7.7636e-03, -2.0870e-02,  6.1992e-03,\n",
      "          1.3833e-02,  1.7105e-02,  1.9798e-02,  4.4006e-03, -7.2556e-03,\n",
      "          6.7625e-03, -2.0531e-03, -1.2533e-02,  1.2025e-02, -5.3363e-04,\n",
      "         -2.5574e-02,  1.6370e-02,  1.2171e-02,  1.0766e-02,  1.0838e-02,\n",
      "          4.0107e-03,  1.5537e-02, -1.1362e-02, -9.6439e-03,  1.4964e-03,\n",
      "          7.8148e-03, -5.6761e-03, -1.1077e-02,  5.9003e-03,  1.4808e-03,\n",
      "          1.2933e-02,  1.1424e-03,  1.1020e-02, -8.0350e-03, -1.4740e-02,\n",
      "          9.1170e-03, -6.3468e-04, -4.0479e-03,  1.3713e-02,  1.1575e-02,\n",
      "          9.8954e-03,  1.3348e-02, -1.2122e-02, -2.2354e-03, -1.1264e-03,\n",
      "         -8.8691e-03,  6.5564e-03, -1.9841e-02,  1.1891e-02, -2.7385e-03,\n",
      "         -1.9336e-02, -9.7163e-03,  7.9618e-03, -6.0816e-03, -9.9823e-03,\n",
      "         -1.1039e-02,  1.6298e-02, -1.6359e-02, -1.6953e-03,  5.9094e-03,\n",
      "         -1.6659e-02,  1.2583e-02, -4.9527e-03, -2.1077e-02,  8.5810e-03,\n",
      "         -9.9342e-03,  2.5942e-03, -1.5352e-02, -8.6206e-03,  1.0801e-02,\n",
      "         -5.2348e-03, -9.8862e-03,  5.1953e-03, -4.1384e-03, -1.7563e-02,\n",
      "          5.8627e-03, -1.4587e-02, -1.3667e-03,  3.4069e-03, -1.3977e-02,\n",
      "          1.7534e-02,  1.9576e-02, -2.1802e-03,  7.4871e-03, -1.4167e-02,\n",
      "         -1.5937e-02,  9.2740e-03, -1.1905e-03,  1.7638e-02,  5.4625e-03,\n",
      "         -2.0205e-02,  1.2449e-02, -6.8336e-03, -1.2109e-02,  1.2632e-02,\n",
      "         -5.3000e-03, -2.2317e-03,  9.0697e-03, -2.3099e-02, -1.1039e-02,\n",
      "          2.0572e-02, -7.1114e-03, -6.2623e-03,  9.8033e-03, -1.7146e-02,\n",
      "          6.5650e-03, -1.2216e-02,  6.2222e-03,  9.3554e-04,  3.5419e-03,\n",
      "         -1.5178e-02,  5.2851e-03,  1.0926e-02,  2.3444e-03,  2.0698e-02,\n",
      "          9.5036e-03,  2.6403e-03, -3.4243e-03,  1.1844e-02, -1.1434e-02,\n",
      "         -3.2240e-03,  1.4178e-02,  2.4105e-02,  8.6689e-03,  1.3334e-02,\n",
      "          6.7942e-03, -1.5594e-02, -4.2180e-03, -3.4030e-03,  1.3156e-02,\n",
      "         -6.5572e-03, -7.2241e-03, -1.0788e-02,  1.1891e-02, -4.7041e-05,\n",
      "         -9.0515e-03, -2.6400e-03, -9.3057e-03, -4.0513e-03,  1.7383e-02,\n",
      "          5.0077e-03,  3.0596e-03, -7.5554e-03,  2.9098e-03, -1.0868e-02,\n",
      "         -7.3580e-03,  2.0181e-02, -1.8623e-02,  5.1433e-03,  1.7638e-02,\n",
      "          6.6412e-04,  6.4148e-03, -4.4466e-03, -8.5989e-04, -6.4566e-03,\n",
      "         -2.5121e-03, -9.2004e-03,  1.1107e-03,  1.3366e-02,  6.2264e-03,\n",
      "          5.4974e-03,  1.1088e-02, -7.3802e-03, -6.7500e-03,  1.3316e-02,\n",
      "          2.1638e-04,  9.3800e-03, -6.7032e-03, -7.6870e-03,  6.1373e-03,\n",
      "         -2.6630e-03, -2.1767e-02, -1.9114e-03, -1.2880e-02,  3.8056e-03,\n",
      "          8.5427e-03,  2.1095e-04, -3.3331e-03, -1.0344e-02,  3.6090e-04,\n",
      "         -5.1983e-03,  1.6655e-02, -7.7154e-03,  3.6334e-03,  6.5404e-03,\n",
      "         -1.2700e-03,  1.0362e-02,  1.9238e-02,  1.6964e-02, -1.0878e-02,\n",
      "         -5.6126e-03,  2.1633e-02, -1.2496e-02, -5.2369e-03,  7.6734e-03,\n",
      "          1.4719e-02,  8.8155e-03,  4.0444e-03, -1.0808e-02,  3.2058e-03,\n",
      "          1.0016e-02, -5.3905e-03,  1.3722e-02, -6.3598e-03,  2.5402e-04,\n",
      "          3.8964e-03,  2.3675e-03,  6.1302e-03,  7.6187e-03,  2.4369e-03,\n",
      "         -5.3487e-03, -2.4645e-03, -1.1257e-02,  1.2473e-02, -3.4695e-03,\n",
      "          8.1089e-03,  1.6908e-02,  8.1369e-03,  1.3736e-02, -4.9675e-03,\n",
      "         -9.5182e-03,  1.2250e-03,  3.9422e-03,  4.9059e-03,  6.5703e-03,\n",
      "         -9.2744e-04,  1.0412e-02,  4.9146e-03, -1.7223e-02,  2.2810e-02,\n",
      "          7.2996e-03,  1.5204e-02,  1.3742e-02, -4.9119e-03, -6.9533e-03,\n",
      "         -6.8657e-03,  1.9674e-02, -7.0558e-03, -2.9031e-03,  1.6266e-03,\n",
      "         -2.8383e-03, -1.7238e-02, -5.3224e-03, -1.6304e-02, -4.1918e-03,\n",
      "         -5.7557e-04,  8.5052e-03,  2.1605e-02, -9.9034e-03, -4.6085e-03,\n",
      "         -2.5590e-03, -5.1429e-03,  8.4572e-03, -6.0191e-03,  2.0289e-02,\n",
      "          1.2832e-02,  5.5149e-04, -1.5973e-02, -2.1169e-03,  1.0398e-02,\n",
      "          8.0445e-04,  4.9709e-03,  1.5101e-02, -1.8536e-02, -1.6142e-02,\n",
      "         -2.1028e-02, -6.1523e-03,  2.0715e-03,  1.6208e-02, -1.9666e-02,\n",
      "          5.8016e-03,  4.3465e-03,  3.7296e-03, -1.5618e-03,  7.2091e-04,\n",
      "         -1.3423e-02,  1.8312e-02,  1.3474e-02, -1.4897e-03, -1.2877e-02,\n",
      "          1.1274e-02,  9.2007e-03, -5.5600e-03,  2.1491e-02, -4.5293e-03,\n",
      "          7.5934e-03, -5.9885e-03,  8.5215e-03, -2.7181e-03, -9.2610e-03,\n",
      "         -9.8163e-03,  2.9164e-03, -1.0030e-02,  1.1532e-02,  4.3610e-04,\n",
      "          5.3448e-03,  6.8355e-03,  2.5281e-03,  1.0386e-02,  6.9423e-03,\n",
      "         -2.1751e-03, -5.8310e-03,  1.9127e-02,  9.5513e-03,  1.1941e-02,\n",
      "         -1.0371e-02,  2.0691e-02, -1.1134e-02, -1.0174e-02,  5.7123e-03,\n",
      "          1.2058e-02, -8.8669e-03,  1.0812e-02, -2.7760e-03,  5.1565e-04,\n",
      "          1.1492e-02, -1.8501e-03, -2.1541e-02, -4.2551e-03, -1.4133e-02,\n",
      "          1.3632e-02, -1.3659e-02,  1.8401e-03, -1.3460e-02,  1.8056e-02,\n",
      "         -1.7905e-02,  7.7887e-03, -2.6737e-03,  1.5890e-03, -4.8222e-03,\n",
      "         -1.0975e-02,  8.9087e-03, -1.3957e-03,  1.2738e-02,  6.9929e-03,\n",
      "         -4.4093e-05,  9.5558e-03, -1.0899e-02, -1.0556e-02,  1.0334e-02,\n",
      "         -1.4487e-02, -1.1650e-02, -1.4705e-03, -1.0584e-02, -5.3298e-04,\n",
      "          1.3024e-02,  2.4073e-02,  9.7721e-04,  1.9770e-03, -4.8868e-03,\n",
      "          5.7758e-03,  8.4673e-03, -5.2417e-03, -9.7239e-04, -6.9310e-03,\n",
      "          6.4806e-03,  3.7011e-03, -4.4110e-03,  1.7207e-02,  6.7304e-03,\n",
      "         -7.1903e-03,  1.2867e-02,  8.3148e-03, -1.0607e-02,  9.5122e-03,\n",
      "          7.2869e-03,  1.7965e-02,  1.8129e-02,  7.3860e-03,  9.3920e-03,\n",
      "          4.0221e-03, -1.6241e-02,  9.0180e-03,  7.5859e-03,  2.3486e-03,\n",
      "          7.0317e-03, -1.9312e-03, -6.5071e-04,  1.0609e-03, -1.2377e-02,\n",
      "          3.3778e-03, -2.5956e-02, -1.0706e-02, -7.6921e-03,  1.0984e-02,\n",
      "          3.2321e-03,  1.5055e-02,  1.5232e-02,  4.4333e-03,  3.3008e-03,\n",
      "          3.7639e-03,  4.6672e-03, -1.4997e-02, -1.1136e-02, -3.5555e-04,\n",
      "         -2.1523e-02,  5.0200e-03,  6.6440e-03,  6.2283e-03, -1.0841e-02]],\n",
      "       grad_fn=<AddmmBackward0>)\n"
     ]
    }
   ],
   "source": [
    "x = torch.randn(1, 3, 224, 224)\n",
    "out = model(x)\n",
    "print(out.shape)\n",
    "print(out)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pytorch",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
